CC=gcc
LD=ld
MV=mv
RM=rm
CFLAGS=-fno-pic -static -fno-strict-aliasing -Wall -ggdb -m32 -fno-omit-frame-pointer -nostdinc -fno-stack-protector -I../h
bootblock: loadblock boot.S buildboot
	$(CC) $(CFLAGS) -c boot.S 
	$(LD) -N -e _start -Ttext 0x7C00 -o bootblock.o boot.o
	objcopy -S -O binary -j .text bootblock.o bootblock
	./buildboot bootblock
	$(MV) bootblock ../
loadblock: load.S setparam.c term.c string.c readkern.c
	$(CC) $(CFLAGS) -c load.S	
	$(CC) $(CFLAGS) -O -c term.c	
	$(CC) $(CFLAGS) -O -c string.c	
	$(CC) $(CFLAGS) -O -c readkern.c	
	$(CC) $(CFLAGS) -O -c setparam.c	
	$(LD) -N -e _start -Ttext 0x2000 -o loadblock.o load.o term.o readkern.o string.o setparam.o
	objcopy -S -O binary loadblock.o loadblock
	$(MV) loadblock ../
buildboot: buildboot.c
	$(CC) -o $@ $<
clean:
	$(RM) -f *.o bootblock loadblock buildboot
